package controleur;

import java.awt.EventQueue;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.Collections;
import java.util.GregorianCalendar;
import java.util.Iterator;

import javax.swing.JList;
import javax.swing.ListModel;
import javax.swing.event.ListDataListener;

import Both.Trajet;
import Both.Transport;
import Both.TypeTransport;
import Both.Ville;

import view.Fenetre1;
import view.Fenetre2;
import view.Fenetre3;

public class Main {

    /**
     * @author Blond Jeremie
     * 
     *         Description: Main
     * 
     */
    public static void main(String[] args) {
        EventQueue.invokeLater(new Runnable() {
            public void run() {

                ArrayList<String> l = new ArrayList<String>();
                ArrayList<Trajet> l2 = new ArrayList<Trajet>();
                Transport avion = new Transport(TypeTransport.AVION, 5, 90);
                Transport bateau = new Transport(TypeTransport.BATEAU, 5, 47);
                Transport train = new Transport(TypeTransport.TRAIN, 5, 150);
                Transport bus = new Transport(TypeTransport.BUS, 1, 50);
                Trajet t0 = new Trajet(Ville.LYON, Ville.MARSEILLE,
                        new GregorianCalendar(2011, Calendar.DECEMBER, 20, 13,
                                20), new GregorianCalendar(2011,
                                Calendar.DECEMBER, 20, 15, 40), avion, 500);

                Trajet t4 = new Trajet(Ville.LYON, Ville.GRENOBLE,
                        new GregorianCalendar(2011, Calendar.DECEMBER, 22, 13,
                                20), new GregorianCalendar(2011,
                                Calendar.DECEMBER, 24, 15, 40), bus, 500);

                Trajet t1 = new Trajet(Ville.MARSEILLE, Ville.NICE,
                        new GregorianCalendar(2011, Calendar.DECEMBER, 20, 15,
                                20), new GregorianCalendar(2011,
                                Calendar.DECEMBER, 20, 17, 10), train, 200);

                Trajet t5 = new Trajet(Ville.MARSEILLE, Ville.NICE,
                        new GregorianCalendar(2011, Calendar.DECEMBER, 20, 15,
                                20), new GregorianCalendar(2011,
                                Calendar.DECEMBER, 20, 17, 10), bus, 200);

                Trajet t3 = new Trajet(Ville.MARSEILLE, Ville.GRENOBLE,
                        new GregorianCalendar(2011, Calendar.DECEMBER, 20, 15,
                                20), new GregorianCalendar(2011,
                                Calendar.DECEMBER, 20, 16, 10), avion, 345);

                Trajet t7 = new Trajet(Ville.MARSEILLE, Ville.GRENOBLE,
                        new GregorianCalendar(2011, Calendar.DECEMBER, 20, 15,
                                20), new GregorianCalendar(2011,
                                Calendar.DECEMBER, 20, 16, 10), bateau, 345);

                Trajet t8 = new Trajet(Ville.MARSEILLE, Ville.PARIS,
                        new GregorianCalendar(2011, Calendar.DECEMBER, 20, 15,
                                20), new GregorianCalendar(2011,
                                Calendar.DECEMBER, 20, 17, 10), bateau, 200);

                Trajet t2 = new Trajet(Ville.NICE, Ville.PARIS,
                        new GregorianCalendar(2011, Calendar.DECEMBER, 20, 13,
                                10), new GregorianCalendar(2011,
                                Calendar.DECEMBER, 20, 16, 10), bateau, 450);

                Trajet t6 = new Trajet(Ville.NICE, Ville.PARIS,
                        new GregorianCalendar(2011, Calendar.DECEMBER, 20, 13,
                                10), new GregorianCalendar(2011,
                                Calendar.DECEMBER, 20, 16, 10), bus, 450);

                Trajet t9 = new Trajet(Ville.NICE, Ville.MARSEILLE,
                        new GregorianCalendar(2011, Calendar.DECEMBER, 20, 13,
                                10), new GregorianCalendar(2011,
                                Calendar.DECEMBER, 20, 16, 10), train, 450);

                Trajet t10 = new Trajet(Ville.PARIS, Ville.GRENOBLE,
                        new GregorianCalendar(2011, Calendar.DECEMBER, 20, 15,
                                20), new GregorianCalendar(2011,
                                Calendar.DECEMBER, 20, 16, 10), avion, 345);

                /*
                 * l2.add(t0); l2.add(t1); l2.add(t2); l2.add(t3); l2.add(t4);
                 * l2.add(t5); l2.add(t6); l2.add(t7); l2.add(t8); l2.add(t9);
                 * l2.add(t10);
                 * 
                 * l.add("a"); l.add("b"); l.add("c");
                 * 
                 * ArrayList<String> l3 = new ArrayList<String>();
                 * Iterator<Trajet> monIterateur = l2.iterator(); Trajet temp;
                 * while(monIterateur.hasNext()){ temp = monIterateur.next();
                 * l3.
                 * add(temp.getVilleDepart().getVille()+"-"+temp.getVilleArrive
                 * ().getVille()); } JList laListe = new JList(l3.toArray());
                 * Fenetre1 f = new Fenetre1(l,laListe, l2, Ville.allVille());
                 * //Fenetre2 f = new Fenetre2("test"); Fenetre3 G = new
                 * Fenetre3("toto"); G.show();
                 */

                ToutFenetre tout = new ToutFenetre();

                /*
                 * tout.monServeur.addTrajet(t0); tout.monServeur.addTrajet(t4);
                 * tout.monServeur.addTrajet(t1); tout.monServeur.addTrajet(t5);
                 * tout.monServeur.addTrajet(t3); tout.monServeur.addTrajet(t7);
                 * tout.monServeur.addTrajet(t8); tout.monServeur.addTrajet(t2);
                 * tout.monServeur.addTrajet(t6); tout.monServeur.addTrajet(t9);
                 * tout.monServeur.addTrajet(t10);
                 */

                tout.maFenetre3.show(true);

            }
        });
    }
}
